package com.esurvey.core;

public class Category {
	private int id;
	private String name;
	
	public Category(String name) throws Exception {
		this.setName(name);
	}
	
	public Category(int id, String name) throws Exception {
		this(name);
		this.setId(id);
	}

	public int getId() { return this.id; }
	public String getName() { return this.name; }
	
	public void setId(int id) {
		this.id = id;
	}
	
	public void setName(String name) throws Exception {
		if (name.length() != 0) {
			this.name = name;
		} else {
			throw new eSurveyException("Invalid category name: '"+name+"'");
		}
	}
}
